﻿@model InformaticaDiaryWeb.Models.ResultPetitionerModel

@{
    ViewBag.Title = "Result Petitioner";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@{
    var grid = new WebGrid(Model.objSearchResult, defaultSort: "sPetitioner");
}

@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)   
    @Html.HiddenFor(m => m.SearchType)
    <fieldset>
        <div data-role="collapsible" data-collapsed="@Model.isRecordExist">
            <h4>Search</h4>
            <ul data-role="listview" data-inset="true">            
                <li data-role="fieldcontain">
                    @Html.LabelFor(m => m.CaseYear)
                    @Html.DropDownListFor(x => x.CaseYear, Model.listCaseYear)
                </li>
                <li data-role="fieldcontain">
                    @Html.LabelFor(m => m.PetitionerName)
                    @Html.EditorFor(x => x.PetitionerName)
                    @Html.ValidationMessageFor(x => x.PetitionerName)
                </li>
                <li data-role="fieldcontain">
                    <input type="submit" value="Search" data-icon="search" />
                </li>
            </ul>
        </div>

        <div data-role="collapsible" data-collapsed="false">
            <h4>Results</h4>
            @if (Model.objSearchResult == null || Model.objSearchResult.Count() < 1)
            {
                <ul data-role="listview" data-inset="true">
                    <li data-role="fieldcontain">No Results found.</li>
                </ul>
            }
            else
            { 
                 @Html.Partial("ResultGrid", Model.objSearchResult)              
            }
        </div>
    </fieldset>
}

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
